Page({
    data: {
        dataArr: [],
        sum: 1
    },
    onLoad: function(t) {
        var a = wx.getSystemInfoSync().windowWidth, n = wx.getSystemInfoSync().windowHeight;
        this.setData({
            width: a,
            height: n
        }), this.getDBData(1);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.getDBData(1);
    },
    onReachBottom: function() {
        var t = this.data.sum;
        this.data.dataArr.length < 10 ? t = 1 : t += 1, this.getDBData(t);
    },
    onShareAppMessage: function() {},
    toDraw: function() {
        wx.navigateTo({
            url: "/pages/drawPic/drawPic"
        });
    },
    getDBData: function(t) {
        var a = (e = this).data;
        1 == t && a.dataArr.splice(0, a.dataArr.length);
        var n = wx.cloud.database().collection("sharePainting"), e = this;
        n.skip(10 * (t - 1)).limit(10).get({
            success: function(t) {
                console.log(t.data);
                for (var n = 0; n < t.data.length; n++) {
                    var o = t.data[n];
                    a.dataArr.push(o);
                }
                e.setData({
                    dataArr: a.dataArr
                }), t.data.length < 10 && 1 != sum && t.data.length < 10 && (sum -= 1), 1 == sum && wx.stopPullDownRefresh();
            }
        });
    },
    toDetail: function(t) {
        var a = [ t.currentTarget.id ];
        wx.previewImage({
            urls: a
        });
    }
});